﻿using System.Collections.Generic;
using IssueIT.WebUI.Models;

namespace IssueIT.WebUI.Infrastructure.Helpers
{
	public class ImageSizeList
	{
		private readonly IDictionary<string, ImageSize> _imageSizeMap = new Dictionary<string, ImageSize>();

		public IEnumerable<string> GetNames()
		{
			return _imageSizeMap.Keys;
		}

		public ImageSize FindByName(string name)
		{
			ImageSize imageSize;
			if( _imageSizeMap.TryGetValue(name, out imageSize) )
			{
				return imageSize;
			}
			throw new KeyNotFoundException(string.Concat("GetImageSize is called with unknown sizeName: ", name));
		}

		public void AddImageSize(string name, ImageSize imageSize)
		{
			_imageSizeMap.Add(name, imageSize);
		}
	}
}